package com.hghivln.erpwarehouse.business.controller;


import com.hghivln.erpwarehouse.business.entity.Salesback;
import com.hghivln.erpwarehouse.business.service.SalesbackService;
import com.hghivln.erpwarehouse.business.vo.SalesbackVo;
import com.hghivln.erpwarehouse.system.common.lang.Result;
import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;

import org.springframework.web.bind.annotation.RestController;

/**
 * <p>
 *  前端控制器
 * </p>
 *
 * @author hghivln
 * @since 2021-07-13
 */
@RestController
@RequestMapping("api/salesback")
public class SalesbackController {

    @Autowired
    private SalesbackService salesbackService;

    @RequestMapping("loadAllSalesback")
    public Object loadAllSalesback(SalesbackVo salesbackVo) {
        return salesbackService.queryAllSalesback(salesbackVo);
    }

    @RequiresPermissions("salesback:add")
    @RequestMapping("addSalesback")
    public Result addSalesback(Salesback salesback) {
        try {
            salesbackService.saveSalesback(salesback);
            return Result.ADD_SUCCESS;
        } catch (Exception e) {
            e.printStackTrace();
            return Result.ADD_ERROR;
        }
    }
}
